public class TestDeme01 {
    public static void main(String[] args) {
        //创建图书馆
        Library library = new Library("新华书店");
        for (int i = 0; i < 10; i++) {
            // 创建除10本书
            Book book = new Book("西游记" + i, "吴承恩", 10, 7 + i);
            // 把书放到图书馆中
            library.addBook(book);
        }

        // 用户
        User user = new User("张三", "123456", "123456", 100f);
        library.addUser(user);

        //--------------------------------------------------------------------------------------------
        // 业务
        //1、
        User loginUser = library.login("123456", "123456");
        if (loginUser != null) {
            System.out.println("登陆成功");
            // 借书
            library.borrowBook("西游记2", 2, 3, loginUser);//借书
            library.borrowBook("西游记1", 3, 1, loginUser);//借书
            // 支付
            boolean res = library.pay(loginUser);
            System.out.println(res ? "支付成功" : "支付失败");
            System.out.println(loginUser.getBalance());
            // 还
            library.returnBook("西游记1", 2);//还书

        } else {
            System.out.println("登陆失败");
        }
    }
}
